package com.dhnsoft.shortLink.project.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dhnsoft.shortLink.project.dao.entity.ShortLinkDO;
import com.dhnsoft.shortLink.project.dto.req.ShortLinkCreateReqDTO;
import com.dhnsoft.shortLink.project.dto.req.ShortLinkPageReqDTO;
import com.dhnsoft.shortLink.project.dto.req.ShortLinkUpdateReqDTO;
import com.dhnsoft.shortLink.project.dto.resp.ShortLinkCountQueryRespDTO;
import com.dhnsoft.shortLink.project.dto.resp.ShortLinkCreateRespDTO;
import com.dhnsoft.shortLink.project.dto.resp.ShortLinkPageRespDTO;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.util.List;

/**
 * ClassName: ShortLinkService
 * Package: com.dhnsoft.shortLink.project.service
 * Description: 短链接服务层
 *
 * @Author dhn
 * @Create 2024/3/21 17:37
 * @Version 1.0
 */
public interface ShortLinkService extends IService<ShortLinkDO> {

    /**
     * 创建短链接
     * @param requestParam 传入短链接相关参数
     * @return
     */
    ShortLinkCreateRespDTO createShortLink(ShortLinkCreateReqDTO requestParam);


    /**
     * 分页查询短链接
     * @param shortLinkPageReqDTO 传入gid
     * @return
     */
    IPage<ShortLinkPageRespDTO> pageShortLink(ShortLinkPageReqDTO shortLinkPageReqDTO);


    /**
     * 返回分组下短链接数量
     * @param requestParam 返回分组下短链接请求参数
     * @return 返回分组下短链接数量返回值
     */
    List<ShortLinkCountQueryRespDTO> listShortLinkCount(List<String> requestParam);


    /**
     * 修改短链接
     * @param requestParam 传入短链接修改参数
     */
    void updateShortLink(ShortLinkUpdateReqDTO requestParam);


    /**
     * 短链接跳转
     * @param shortUri 短链接后缀
     * @param request  HTTP请求
     * @param response 响应
     */
    void restoreUrl(String shortUri, HttpServletRequest request, HttpServletResponse response);
}
